const { merge } = require('webpack-merge');
const path = require('path');
const webpack = require('webpack');
const commonConfig = require('./webpack.common');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
module.exports = merge(commonConfig, {
  mode: 'production',
  plugins: [
    new UglifyJSPlugin({
      uglifyOptions: {
        compress: {
          drop_debugger: true, // 清除debugger語句
          drop_console: true,
          pure_funcs: ['console.log'] // 清除console
        },
        warnings: false,
      },
      sourceMap: true,
      parallel: true,
      cache: true
    }),
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify('production')
    })
  ],
  output: {
    filename: '[name].bundle.js',
    path: path.resolve(__dirname, 'chrome-plugin/html')
  },

});